package com.joysuch.wwyt.bp.entity.investigate;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * @Author ZhangDong
 * @Date 2020/3/26 9:18
 */
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_bp_investigate_record")
@SQLDelete(sql = "update wwyt_bp_investigate_record set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_bp_investigate_record set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Data
@Accessors(chain = true)
public class BpInvestigateRecord {

    @Id
//    @GeneratedValue(strategy = IDENTITY)
    @TableId(value = "id", type = IdType.INPUT)
    @ApiModelProperty("主键id")
    private Long id;
    @ApiModelProperty("检查计划Id")
    private Long checkPlanId;
    @ApiModelProperty("排查人员Id")
    private Long checkUserId;
    @ApiModelProperty("排查完成日期")
    private Date checkFinishDate;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("异常总数")
    private Integer exceptionSum;
    @ApiModelProperty("异常处理状态")
    private String exceptionHandleStatus;
    @ApiModelProperty("检查结果")
    private String checkResult;
    @ApiModelProperty("责任部门")
    private Long dutyDepartId;
    @ApiModelProperty("任务表id")
    private Long taskId;
    @ApiModelProperty("参与人员Json")
    private String participants;

    @ApiModelProperty("数据来源类型")
    private Integer sourceType;

    @ApiModelProperty("签到位置")
    private String verifyLocation;
    @ApiModelProperty("签到方式")
    private String verifyType;
    @ApiModelProperty("签到状态")
    private String verifyState;

    @ApiModelProperty("未检原因eg:'超时未检','异常未检'")
    private String uncheckReason;

    //通用字段
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    @JsonIgnore
    private Long createBy;
    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    private java.time.LocalDateTime createTime;
    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    @JsonIgnore
    private Long updateBy;
    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    @JsonIgnore
    private java.time.LocalDateTime updateTime;
    @ApiModelProperty("租户")
    private Long tenentId;
    @ApiModelProperty("组织机构代码")
    private String orgCode;
    @ApiModelProperty("删除标记")
    @JsonIgnore
    private String deleteFlag;
}
